﻿@{
    Layout = "~/Views/Shared/_LayoutPageb.cshtml";
}
<script src="~/Scripts/upload/uploadPreview.js"></script>
<link href="~/Scripts/bootstrap-fileinput/css/fileinput.css" rel="stylesheet" />
<script src="~/Scripts/bootstrap-fileinput/js/fileinput.js?3"></script>
<script src="~/Scripts/bootstrap-fileinput/js/locales/zh.js"></script>
<script src="~/Scripts/bootstrap-fileinput/themes/fa/theme.js"></script>

<style type="text/css">
    td, th {
        vertical-align: middle !important;
    }

    th, tr {
        word-break: keep-all;
        word-spacing: normal;
        text-align: center;
        white-space: nowrap;
    }

    .tooltip-inner {
        max-width: inherit !important;
    }

    .tooltip-inner-table.table, .tooltip-inner-IncomeTax.table {
        background: #000;
        margin-top: 5px;
    }

    .tooltip-inner-table > tbody > tr td {
        background: #000;
    }

    .tooltip-inner-table.table {
        border: 1px solid #fff;
    }

    .table-striped > tbody > tr > td {
        background: none !important;
    }

    d .tooltip-inner-table.table td, .tooltip-inner-table.table th {
        border-right: 1px solid #fff;
        border-bottom: 1px solid #fff;
    }

    .status {
        width: 120px;
        display: inline-block;
        height: 29px;
        color: #333;
        background-color: #fff;
        border-color: #ccc;
        border-radius: 4px;
        vertical-align: middle;
    }

    .file-preview .close {
        display: none;
    }
</style>
@section RightPage{
    <section>
        <div>
            <!--body wrapper start-->
            <div class="wrapper">
                <section class="panel">
                    <header class="panel-heading">
                        员工信息更新
                    </header>
                    <div class="panel-body">
                        <div class="adv-table editable-table " style="position:relative;">
                            @*<div class="search-body search-label table-left">
                                    <div class="panel-search-change">
                                        <ul>
                                            <li>
                                                <label class="col-md-3 col-sm-3 control-label" style="width:100px;">审核状态</label>
                                                <div class="col-md-5 col-sm-5">
                                                    <label>
                                                        <select name="status" style="padding-right:0px; width:155px;" id="status" class="form-control xsmall">
                                                            <option value="0" selected>所有申请</option>
                                                            <option value="1">未审核</option>
                                                            <option value="2">驳回</option>
                                                            <option value="3">通过</option>
                                                        </select>
                                                    </label>
                                                </div>
                                            </li>
                                        </ul>
                                    </div>
                                </div>*@
                            <table class="table table-hover" width="100%" id="editable-sample"></table>
                        </div>
                    </div>
                </section>
            </div>
        </div>
        <!--body wrapper end-->

        <div id="toolbar" class="toolbar">
            <select name="status" id="status" class="xsmall status">
                <option value="0" selected>所有申请</option>
                <option value="1">未审核</option>
                <option value="2">驳回</option>
                <option value="3">通过</option>
            </select>
            <a class="btn btn-default" id="btnAdd">新增申请</a>
            <a class="btn btn-default" id="btnEditNumber">批量修改基数</a>
            <a class="btn btn-default" id="btnAudit">批量审核</a>
        </div>
    </section>

}
@section DialogMould{
    <div class="modal fade hideDiv in" id="AddDialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: none;">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title" id="title">新增申请</h4>
                </div>
                <div class="modal-body">
                    <div class="form-horizontal ">
                        <form id="addForm" enctype="multipart/form-data" novalidate="novalidate">
                            <div class="form-group">
                                <label class="control-label col-md-3">新增类型</label>
                                <div class="col-md-8">
                                    <select name="ItemType" style="width:100%" id="ItemType" class="form-control xsmall">
                                        <option value="">请选择</option>
                                        <option value="1">工资</option>
                                        <option value="2">社保</option>
                                        <option value="3">公积金</option>
                                        <option value="4">补充公积金</option>
                                        <option value="5">离职员工修改</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-3">选择立项</label>
                                <div class="col-md-8">
                                    <select name="cmbCusContractID" style="width:100%" id="cmbCusContractID" class="form-control xsmall" data-live-search="true" data-live-search-placeholder="请选择" data-actions-box="true">
                                        <option value="">请选择</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-3">选择员工</label>
                                <div class="col-md-8">
                                    <select name="cmbStaffContractID" style="width:100%" id="cmbStaffContractID" class="form-control xsmall" data-live-search="true" data-live-search-placeholder="请选择" data-actions-box="true">
                                        <option value="">请选择</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-3">证件号</label>
                                <div class="col-md-8">
                                    <input type="text" id="IDCard" name="IDCard" placeholder="证件号" disabled class="form-control">
                                </div>
                            </div>
                            <!--工资-->
                            <div class="ToggleType panel-body hideDiv" data-type="1" style="display:none; padding:0;">
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">是否发放工资</label>
                                    <div class="col-md-8 col-sm-8">
                                        <div style="width:98%;height:auto;float:left">
                                            <select id="cmbSalaryPayMentStatus" name="cmbSalaryPayMentStatus" size="1" style="width:100%" class="form-control ">
                                                <option value="" selected>--请选择--</option>
                                                <option value="true">是</option>
                                                <option value="false">否</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">试用期月数</label>
                                    <div class="col-md-8 col-sm-8">
                                        <div style="width:98%;height:auto;float:left">
                                            <input id="txtProbationPeriod" name="txtProbationPeriod" type="text" placeholder="试用期月数" class="form-control ">
                                        </div>
                                    </div>
                                </div>
                                <div id="NonFloatWagesDtl"></div>
                                @*<div class="form-group">
                                        <label class="col-md-3 col-sm-3 control-label">试用期工资</label>
                                        <div class="col-md-8 col-sm-8">
                                            <div style="width:98%;height:auto;float:left">
                                                <input id="txtPPSalary" name="txtPPSalary" type="text" placeholder="试用期工资" class="form-control ">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-md-3 col-sm-3 control-label">转正后工资</label>
                                        <div class="col-md-8 col-sm-8">
                                            <div style="width:98%;height:auto;float:left">
                                                <input id="txtFormalSalary" name="txtFormalSalary" type="text" placeholder="转正后工资" class="form-control ">
                                            </div>
                                        </div>
                                    </div>*@
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">工资始发日期</label>
                                    <div class="col-md-8 col-sm-8 ">
                                        <div style="width:98%;height:auto;float:left">
                                            <input class="dp4 form-control" id="txtSalaryStartDate" name="txtSalaryStartDate" placeholder="请选择工资始发日期" size="16" type="text">
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">工资止发日期</label>
                                    <div class="col-md-8 col-sm-8 ">
                                        <div style="width:98%;height:auto;float:left">
                                            <input class="dp5 form-control" id="txtSalaryEndDate" name="txtSalaryEndDate" placeholder="请选择工资止发日期" size="16" type="text">
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">发薪银行</label>
                                    <div class="col-md-8 col-sm-8 ">
                                        <div style="width:98%;height:auto;float:left">
                                            <select name="PayrollBankId" id="PayrollBankId" class="form-control"></select>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">发薪地</label>
                                    <div class="col-md-8 col-sm-8 ">
                                        <div style="width:98%;height:auto;float:left;">
                                            <ul style="list-style:none;display:inline;">
                                                <li style="width: 45%;display:inline-block">
                                                    <select id="cmbSalaryProvince" name="cmbSalaryProvince" size="1" style="width:98%" class="xsmall form-control">
                                                        <option value="">--请选择--</option>
                                                    </select>
                                                </li>
                                                <li style="width: 45%; display: inline-block">
                                                    <select id="cmbSalaryCity" name="cmbSalaryCity" size="1" style="width:98%" class="xsmall form-control">
                                                        <option value="">--请选择--</option>
                                                    </select>
                                                </li>
                                            </ul>
                                        </div>
                                        <div style="width:1%;height:auto;float:left;">
                                            <label class="TipStar">*</label>
                                        </div>
                                    </div>
                                </div>
                                <div id="bankCardNoListDiv" class="hideDiv">
                                    <div class="form-group">
                                        <label class="col-md-3 col-sm-3 control-label">是否现金</label>
                                        <div class="col-md-8 col-sm-8 ">
                                            <div style="width:98%;height:auto;float:left">
                                                @*<input type="checkbox" id="isCash" name="isCash" value="0">*@
                                                <select id="isCash" name="isCash" size="1" style="width:100%" class="form-control ">
                                                    <option value="">--请选择--</option>
                                                    <option value="true" selected>是</option>
                                                    <option value="false">否</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    <div id="IsNotCash">
                                        <div class="form-group">
                                            <label class="col-md-3 col-sm-3 control-label"></label>
                                            <div class="col-md-8 col-sm-8 ">
                                                <div style="width:98%;height:auto;float:left">
                                                    <a class="btn btn-default AddBackCard" data-count="0" data-col="[3,8]">新增银行卡</a>
                                                </div>
                                            </div>
                                        </div>
                                        <div id="BankList"></div>
                                    </div>
                                </div>
                            </div>
                            <!--社保-->
                            <div class="ToggleType panel-body hideDiv" data-type="2" style="display:none; padding:0;">
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">是否缴纳社保</label>
                                    <div class="col-md-8 col-sm-8">
                                        <div style="width:98%;height:auto;float:left">
                                            <select id="cmbSIPayMentStatus" name="cmbSIPayMentStatus" size="1" style="width:100%" class="form-control ">
                                                <option value="">--请选择--</option>
                                                <option value="true" selected>是</option>
                                                <option value="false">否</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">社保是否预收</label>
                                    <div class="col-md-8 col-sm-8">
                                        <div style="width:98%;height:auto;float:left">
                                            <select id="SIReceived" name="SIReceived" size="1" style="width:100%" class="form-control ">
                                                <option value="1">是</option>
                                                <option value="0">否</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">社保缴纳类型</label>
                                    <div class="col-md-8 col-sm-8">
                                        <div style="width:98%;height:auto;float:left">
                                            <select id="cmbSIPayMentType" name="cmbSIPayMentType" size="1" style="width:100%" class="form-control ">
                                                <option value="" selected>--请选择--</option>
                                                <option value="1">城保五险</option>
                                                <option value="2">镇保</option>
                                                <option value="3">城保三险</option>
                                                <option value="4">其他</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">社保起缴日期</label>
                                    <div class="col-md-8 col-sm-8 ">
                                        <div style="width:98%;height:auto;float:left">
                                            <input class="dp4 form-control" id="txtSIStartDate" name="txtSIStartDate" placeholder="请选择社保起缴日期" size="16" type="text" value="">
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">社保止缴日期</label>
                                    <div class="col-md-8 col-sm-8 ">
                                        <div style="width:98%;height:auto;float:left">
                                            <input class="dp5 form-control" id="txtSIEndDate" name="txtSIEndDate" placeholder="请选择社保止缴日期" size="16" type="text" value="">
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">是否多基数</label>
                                    <div class="col-md-8 col-sm-8">
                                        <div style="width:98%;height:auto;float:left">
                                            <select id="SIMultiBase" name="SIMultiBase" size="1" style="width:100%" class="form-control">
                                                <option value="1" selected>是</option>
                                                <option value="0">否</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group" id="djs">
                                    <label class="col-md-3 col-sm-3 control-label">社保缴费基数</label>
                                    <div class="col-md-8 col-sm-8" style="position:relative;">
                                        <div style="width:98%;height:auto;float:left">
                                            <input id="txtBasicNumber" name="txtBasicNumber" type="text" placeholder="社保缴费基数" class="form-control " value="">
                                        </div>
                                        @*<div id="SiBasicNumber" class="tooltip-show tiptool" data-toggle="tooltip" data-html="true" style="position:absolute;right:2px;top:4px;">
                    <i class="fa fa-question-circle"></i>
                </div>*@
                                    </div>
                                </div>
                                <div id="StaffSIUpdateDtl"></div>
                                <div class="form-group" id="SI_SINo">
                                    <label class="col-md-3 col-sm-3 control-label">社保编号</label>
                                    <div class="col-md-8 col-sm-8">
                                        <div style="width:98%;height:auto;float:left">
                                            <input id="txtNo" name="txtNo" type="text" placeholder="社保编号" class="form-control " value="">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--公积金-->
                            <div class="ToggleType panel-body hideDiv" data-type="3" style="display:none; padding:0;">
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">是否缴纳公积金</label>
                                    <div class="col-md-8 col-sm-8">
                                        <div style="width:98%;height:auto;float:left">
                                            <select id="cmbHFundPayMentStatus" name="cmbHFundPayMentStatus" size="1" style="width:100%" class="form-control">
                                                <option value="">--请选择--</option>
                                                <option value="true" selected>是</option>
                                                <option value="false">否</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">公积金是否预收</label>
                                    <div class="col-md-8 col-sm-8">
                                        <div style="width:98%;height:auto;float:left">
                                            <select id="HFReceived" name="HFReceived" size="1" style="width:100%" class="form-control ">
                                                <option value="1">是</option>
                                                <option value="0">否</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">公积金起缴日期</label>
                                    <div class="col-md-8 col-sm-8 ">
                                        <div style="width:98%;height:auto;float:left">
                                            <input class="dp4 form-control" id="txtHFundStartDate" placeholder="请选择公积金起缴日期" name="txtHFundStartDate" size="16" type="text" value="">
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">公积金止缴日期</label>
                                    <div class="col-md-8 col-sm-8 ">
                                        <div style="width:98%;height:auto;float:left">
                                            <input class="dp5 form-control" id="txtHFundEndDate" placeholder="请选择公积金止缴日期" name="txtHFundEndDate" size="16" type="text" value="">
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">公积金缴费基数</label>
                                    <div class="col-md-8 col-sm-8" style="position:relative;">
                                        <div style="width:98%;height:auto;float:left">
                                            <input id="txtHFundBasicNumber" name="txtHFundBasicNumber" type="text" placeholder="公积金缴费基数" class="form-control " value="">
                                        </div>
                                        @*<div id="HFundBasicNumber" class="tooltip-show tiptool" data-toggle="tooltip" data-html="true" style="position:absolute;right:2px;top:4px;">
                                              <i class="fa fa-question-circle"></i>
                                            </div>*@
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="staffHFund">
                                        <label class="col-md-3 col-sm-3 control-label">个人公积金比例</label>
                                        <div class="col-md-8 col-sm-8 ">
                                            <div style="width:98%;height:auto;float:left">
                                                <input type="text" id="txtHFundIScale" name="txtHFundIScale" placeholder="个人公积金比例" class="form-control valid " aria-invalid="false">
                                            </div>
                                            <div style="WIDTH: 1%;FLOAT: LEFT;MARGIN-TOP: 6PX;">
                                                %
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group" id="SI_HFundNo">
                                    <label class="col-md-3 col-sm-3 control-label">公积金账号</label>
                                    <div class="col-md-8 col-sm-8">
                                        <div style="width:98%;height:auto;float:left">
                                            <input id="txtHFundNo" name="txtHFundNo" type="text" placeholder="公积金账号" class="form-control " value="">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--补充公积金-->
                            <div class="ToggleType panel-body hideDiv" data-type="4" style="display:none; padding:0;">
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">是否缴纳补充公积金</label>
                                    <div class="col-md-8 col-sm-8">
                                        <div style="width:98%;height:auto;float:left">
                                            <select id="cmbPSHFundPayMentStatus" name="cmbPSHFundPayMentStatus" size="1" style="width:100%" class="form-control">
                                                <option value="">--请选择--</option>
                                                <option value="true">是</option>
                                                <option value="false" selected>否</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">补充公积金起缴日期</label>
                                    <div class="col-md-8 col-sm-8 ">
                                        <div style="width:98%;height:auto;float:left">
                                            <input class="dp4 form-control" id="txtPSHFundStartDate" name="txtPSHFundStartDate" placeholder="请选择补充公积金起缴日期" size="16" type="text" value="">
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">补充公积金止缴日期</label>
                                    <div class="col-md-8 col-sm-8 ">
                                        <div style="width:98%;height:auto;float:left">
                                            <input class="dp5 form-control" id="txtPSHFundEndDate" name="txtPSHFundEndDate" placeholder="请选择补充公积金止缴日期" size="16" type="text" value="">
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">补充公积金缴费基数</label>
                                    <div class="col-md-8 col-sm-8" style="position:relative;">
                                        <div style="width:98%;height:auto;float:left">
                                            <input id="txtPSHFundBasicNumber" name="txtPSHFundBasicNumber" type="text" placeholder="补充公积金缴费基数" class="form-control ">
                                        </div>
                                        @*<div id="PSHFundBasicNumber" class="tooltip-show tiptool" data-toggle="tooltip" data-html="true" style="position:absolute;right:2px;top:4px;">
                                                <i class="fa fa-question-circle"></i>
                                            </div>*@
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="staffPSHFund">
                                        <label class="col-md-3 col-sm-3 control-label">个人补充公积金比例</label>
                                        <div class="col-md-8 col-sm-8 ">
                                            <div style="width:98%;height:auto;float:left">
                                                <input type="text" id="txtPSHFundIScale" name="txtPSHFundIScale" placeholder="个人补充公积金比例" class="form-control valid " aria-invalid="false">
                                            </div>
                                            <div style="WIDTH: 1%;FLOAT: LEFT;MARGIN-TOP: 6PX;">
                                                %
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group" id="SI_PSHFundNo">
                                    <label class="col-md-3 col-sm-3 control-label">补充公积金账号</label>
                                    <div class="col-md-8 col-sm-8">
                                        <div style="width:98%;height:auto;float:left">
                                            <input id="txtPSHFundNo" name="txtPSHFundNo" type="text" placeholder="补充公积金账号" class="form-control ">
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <!--离职员工信息修改-->
                            <div class="ToggleType panel-body hideDiv" data-type="5" style="display:none; padding:0;">
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">离职方式</label>
                                    <div class="col-md-8 col-sm-8">
                                        <select id="cmbDimissionType" name="cmbDimissionType" size="1" style="width:100%" class="xsmall form-control">
                                            <option value="" selected>--请选择--</option>
                                            <option value="1">协商解除</option>
                                            <option value="2">单方面解除</option>
                                            <option value="3">辞职报告</option>
                                            <option value="4">合同到期</option>
                                            <option value="5">退休终止</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">离职日期</label>
                                    <div class="col-md-8 col-sm-8 ">
                                        <input class="form-control form-control-inline input-medium dp4" id="txtDimissionDate" name="txtDimissionDate" placeholder="离职日期" size="16" type="text">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">发薪止缴月</label>
                                    <div class="col-md-8 col-sm-8">
                                        <input id="SalaryFinalPaymentMonth" name="SalaryFinalPaymentMonth" size="1" style="width:100%" class="xsmall form-control" />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">社保止缴月</label>
                                    <div class="col-md-8 col-sm-8">
                                        <input id="SIFinalPaymentMonth" name="SIFinalPaymentMonth" size="1" style="width:100%" class="xsmall form-control" />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">公积金止缴月</label>
                                    <div class="col-md-8 col-sm-8">
                                        <input id="HFundFinalPaymentMonth" name="HFundFinalPaymentMonth" size="1" style="width:100%" class="xsmall form-control" />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">补充公积金止缴月</label>
                                    <div class="col-md-8 col-sm-8">
                                        <input id="PSHFundFinalPaymentMonth" name="PSHFundFinalPaymentMonth" size="1" style="width:100%" class="xsmall form-control" />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">经济补偿金</label>
                                    <div class="col-md-8 col-sm-8">
                                        <input id="txtEconomicCompensation" name="txtEconomicCompensation" type="text" placeholder="经济补偿金" class="form-control ">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label" for="exampleInputFile">离职原因附件</label>
                                    <div class="col-md-8 col-sm-8" id="Leavefile" style="overflow:hidden;">
                                        <div style="width:98%;height:auto;float:left">
                                            <input type="file" id="fileList" class="file-loading" multiple>
                                        </div>
                                        <div style="width:1%;height:auto;float:left;">
                                            <label class="TipStar">*</label>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-md-3 col-sm-3 control-label">离职原因</label>
                                    <div class="col-md-8 col-sm-8">
                                        <textarea id="txtDimissionCause" name="txtDimissionCause" rows="5" cols="60" class="form-control"></textarea>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-3">生效日期</label>
                                <div class="col-md-8">
                                    <input type="text" class="dp4 form-control xsmall f14 w210 pull-left" placeholder="选择日期" maxlength="10" name="EffectiveDate" id="EffectiveDate" />
                                    <a class="btn btn-success pull-left" style="height:32px;line-height:21px; margin-left:10px;" onclick="$('#EffectiveDate').datepicker('setDate', new Date())">立即生效</a>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-3">备注</label>
                                <div class="col-md-8">
                                    <textarea id="txtDescription" name="txtDescription" rows="5" cols="60" class="form-control"></textarea>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="modal-footer">
                    <button id="btnSave" class="btn btn-success" type="button">保存</button>
                    <button data-dismiss="modal" class="btn btn-default" type="button">取消</button>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade hideDiv in" id="NumberDialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: none;">
        <div class="modal-dialog" style="width:1200px;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title">新增基数调整申请</h4>
                </div>
                <div class="modal-body">
                    <div class="form-horizontal ">
                        <form id="addNumberForm" enctype="multipart/form-data" novalidate="novalidate">
                            <div class="form-group">
                                <label class="control-label col-md-3">更新类型</label>
                                <div class="col-md-8">
                                    <select name="NumberItemType" style="width:100%" id="NumberItemType" class="form-control xsmall">
                                        <option value="">请选择</option>
                                        <option value="1">工资</option>
                                        <option value="2">社保</option>
                                        <option value="3">公积金</option>
                                        <option value="4">补充公积金</option>
                                    </select>
                                </div>
                            </div>
                            <div class="alert alert-danger" role="alert">
                                请把基数的格式设置成文本类型。
                            </div>
                            <div class="form-group">
                                <table class="table table-hover" width="100%" id="editable-sample-staff">
                                </table>
                            </div>
                            @*<div class="form-group">
                                    <label class="control-label col-md-3">调整类型</label>
                                    <div class="col-md-8">
                                        <select name="AdjustmentType" style="padding-right:0px; width:155px;" id="AdjustmentType" class="form-control xsmall">
                                            <option value="">请选择</option>
                                            <option value="1">上调</option>
                                            <option value="2">下调</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-md-3">调整基数</label>
                                    <div class="col-md-8">
                                        <input type="text" id="AdjustmentBasicNumber" name="AdjustmentBasicNumber" placeholder="调整基数" class="form-control">
                                    </div>
                                </div>*@
                            <div class="form-group">
                                <label class="control-label col-md-3"></label>
                                <div class="col-md-8">
                                    <a class="btn btn-default" id="Exit">导出模板</a>
                                    <a class="btn btn-default" style="position:relative;overflow:hidden; margin-left:8px;">导入模板<input type="file" id="importf" style="position:absolute;left:0;top:0;height:30px;opacity:0;filter:alpha(opacity=0);" value="导入" /></a>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-3">生效日期</label>
                                <div class="col-md-8">
                                    <input type="text" class="dp4 form-control xsmall f14 w210 pull-left" placeholder="选择日期" maxlength="10" name="NEffectiveDate" id="NEffectiveDate" />
                                    <a class="btn btn-success pull-left" style="height:32px;line-height:21px; margin-left:10px;" onclick="$('#NEffectiveDate').datepicker('setDate', new Date())">立即生效</a>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-md-3">备注</label>
                                <div class="col-md-8">
                                    <textarea id="Description" name="Description" rows="5" cols="60" class="form-control"></textarea>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="modal-footer">
                    <button id="btnNumberSave" class="btn btn-success" type="button">保存</button>
                    <button data-dismiss="modal" class="btn btn-default" type="button">取消</button>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade hideDiv in" id="MyModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false" style="display: none;">
        <div class="modal-dialog" style="width:1200px;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title" id="title">审核申请</h4>
                </div>
                <div class="modal-body">
                    <table class="table table-hover" width="100%" id="editable-sample-audit">
                    </table>
                    <form id="Form" style="overflow:hidden;margin-top:30px;">
                        <div class="form-group">
                            <label class="control-label col-md-3">审核理由</label>
                            <div class="col-md-8">
                                <textarea class="form-control" id="AuditReason" name="AuditReason"></textarea>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <a class="btn btn-default" data-dismiss="modal">关闭</a>
                    <a class="btn btn-success  IsAudit" id="IsSuccess">通过</a>
                    <a class="btn btn-warning IsAudit" id="IsTurn">驳回</a>
                </div>
            </div>
        </div>
    </div>
}
@section Script{
    <script src="~/Scripts/lsmjs/EditStaffInfo.js"></script>
    <script src="~/Scripts/lsmjs/setBankList.js?1"></script>
    <script type="text/javascript" src="~/Scripts/web-import/xlsx.full.min.js"></script>
    <script type="text/javascript">
        var oTable;
        var oTableAudit;
        var TotolCount = 0;
        var oTableStaff;
        var info;
        var id;
        var CitySIAndHFundScale;
        var SocialInsuranceEx = [];
        var StaffSIUpdateDtl = [];
        var BankOfSalaryCardInfo;
        var BankOfSalaryCardInfo;
        var flag = false;

        var NewAttachment = [];
        var NewAttachment1 = [];

        var DataPKID = 0;
        //旧的合同附件
        var Attachment;
        //离职id
        var DimissionID;

        //哈希对象
        var hashData;
        var hashObj = {};

        var contractUrlList = [];
        var contractConfig = [];
        jQuery(document).ready(function () {

            //月份
            $("#SalaryFinalPaymentMonth,#SIFinalPaymentMonth,#HFundFinalPaymentMonth,#PSHFundFinalPaymentMonth").datepicker(
                {
                    language: "cn",
                    format: 'yyyy-mm',
                    autoclose: true,
                    minViewMode: 1,
                    maxViewMode: 2,
                    startView: 1,
                }).on("changeDate", function (ev) {
                    var id = $(ev.currentTarget).attr("id");
                    var oldValue = $.trim($(this).attr("oldvalue"));
                    var newValue = $.trim($(this).val());
                    oldValue == newValue ? $(this).attr("ischange", false) : $(this).attr("ischange", true);
                });
            $(".dp4,.dp5").on("changeDate", function (ev) {
                var id = $(ev.currentTarget).attr("id");
                if (id == 'EffectiveDate') {
                    return;
                }
                var oldValue = $.trim($(this).attr("oldvalue"));
                var newValue = $.trim($(this).val());
                oldValue == newValue ? $(this).attr("ischange", false) : $(this).attr("ischange", true);
            });


            formValidate();

            oTableAudit = $('#editable-sample-audit')
            oTableAudit.bootstrapTable({
                search: true,
                cache: false,
                striped: true,
                //showRefresh: true,
                //showToggle: true,
                buttonsAlign: "left",
                uniqueId: "ID",
                idField: "ID",
                height: 500,
                //pageList: ['10', '50'],
                searchOnEnterKey: false,
                //sidePagination: 'client', //server
                pagination: false,
                singleSelect: false,
                maintainMetaData: true,
                columns: [{
                    checkbox: true,
                    field: 'ck',
                    title: '',
                    footerFormatter: function (data) {
                        return '总共 ' + TotolCount + ' 条记录'
                    }
                },
                {
                    field: 'ContractNo',
                    title: '合同号',
                }, {
                    field: 'ContractName',
                    title: '合同名称'
                }, {
                    field: 'Name',
                    title: '姓名',
                }, {
                    field: 'IDCard',
                    title: '证件号',
                }, {
                    field: 'UpdateTypeName',
                    title: '更新类型'
                }, {
                    field: 'EffectiveDate',
                    title: '生效日期'
                }, {
                    field: 'CreateTime',
                    title: '申请时间'
                }],
                classes: 'table-hover table-striped',
                showFooter: true, //显示表格底部
                onClickRow: function (row, $element) {
                    //curRow = row;
                },
                onLoadSuccess: function (aa, bb, cc) {

                }
            })

            //新增申请
            $("#btnAdd").click(function () {
                $("#ItemType").val('').change();
                $("#cmbStaffContractID,#IDCard").val('');
                $("#AddDialog").modal("show")
            });
            //基数调整
            $("#btnEditNumber").click(function () {
                $("#NumberItemType").val('').change();
                $("#addNumberForm input,#addNumberForm select,textarea").val('');
                $("#NumberDialog").modal("show")
            })
            //批量审核
            $("#btnAudit").click(function () {
                $("#Loading").show()
                oTableAudit.bootstrapTable('removeAll');
                setTimeout(function () {
                    $.ajax({
                        type: "GET",
                        url: '/Staff/InfoUpdate/BatchStaffUpdateInfoQuery',
                        cache: false,
                        error: function (request) {
                            alert("服务器错误");
                        },
                        success: function (jsonData) {
                            var result = JSON.parse(jsonData);
                            if (result.StatusCode == 200) {
                                var Data = JSON.parse(result.Data);
                                TotolCount = Data.length;
                                oTableAudit.bootstrapTable('load', Data);
                                setTimeout(function () {
                                    oTableAudit.bootstrapTable('resetView');
                                }, 300)
                            }
                            $("#Loading").hide()
                        }
                    });
                    $("#AuditReason").val('');
                    $("#MyModal").modal('show');
                }, 50)
            })

            $(".IsAudit").click(function () {
                if (!$("#Form").valid())
                    return
                var id = $(this).attr("id");
                var AuditResult = id == 'IsSuccess' ? true : false;
                var aoData = oTableAudit.bootstrapTable('getSelections');
                var Data = [];
                $.each(aoData, function (k, v) {
                    Data.push({ ID: v.ID, UpdateType: v.UpdateType });
                })
                $("#IsSuccess").attr("disabled", "disabled");
                $("#Loading").show();
                $.ajax({
                    type: "POST",
                    data: { AuditResult: AuditResult, AuditReason: $("#AuditReason").val(), AuditList: JSON.stringify(Data) },
                    url: '/Staff/InfoUpdate/BatchAuditStaffUpdateInfo',
                    cache: false,
                    error: function (request) {
                        alert("服务器错误");
                    },
                    success: function (jsonData) {
                        var result = JSON.parse(jsonData);
                        oTable.bootstrapTable("refresh")
                        if (result.StatusCode == 200) {
                            $("#MyModal").modal('hide');
                            $("#Loading").hide();
                            $("#IsSuccess").removeAttr("disabled")
                            msghelper.alertDialog("提示", result.ErrorMessage);
                        } else {
                            $("#Loading").hide();
                            $("#IsSuccess").removeAttr("disabled")
                            msghelper.alertDialog("提示", result.ErrorMessage);
                        }

                    }
                });
            })

            //选择申请类型后获取对应类型下的客户立项信息
            $("#ItemType").change(function () {
                var type = $(this).attr("value");
                $("#cmbCusContractID,#cmbStaffContractID,#IDCard").attr("value");
                $(".Initform").remove();
                $(".ToggleType[data-type=" + type + "] input,.ToggleType[data-type=" + type + "] select").attr("value");

                $(".ToggleType").hide();
                $(".ToggleType[data-type='" + type + "']").show();
                if (type == '') {
                    return;
                }

                $.ajax({
                    type: "GET",
                    url: '/Staff/InfoUpdate/GetCusContractInfoByType/' + type,
                    cache: false,
                    error: function (request) {
                        alert("服务器错误");
                    },
                    success: function (jsonData) {
                        var result = $.parseJSON(jsonData);
                        if (result.StatusCode == '200') {
                            result = JSON.parse(result.Data);
                            var html = '<option value="">--请选择--</option>';
                            for (var i = 0; i < result.length; i++) {
                                html += '<option value="' + result[i].ID + '">' + result[i].ContractName + '</option>';
                            }
                            $("#cmbCusContractID").selectpicker('destroy').html(html).selectpicker({
                                selectAllText: '全选',
                                deselectAllText: "清除",
                                showContent: true,
                                noneSelectedText: "请选择",
                                liveSearchPlaceholder: "请输入关键字",
                            }).selectpicker('refresh').selectpicker('render');
                        }
                    }
                });
            });

            //选择立项后获取对应立项下可申请信息更新的员工信息
            $("#cmbCusContractID").change(function () {
                var type = $("#ItemType").attr("value");
                var cusContractID = $("#cmbCusContractID").attr("value");
                if (cusContractID == '' || type == '') {
                    return;
                }
                getStaffInfo(type, cusContractID);
                if (type == 5) {
                    $("#SalaryFinalPaymentMonth,#SIFinalPaymentMonth,#HFundFinalPaymentMonth,#PSHFundFinalPaymentMonth").closest(".form-group").show();
                }
            })


            oTableStaff = $('#editable-sample-staff')
            oTableStaff.bootstrapTable({
                search: true,
                cache: false,
                striped: true,
                //showRefresh: true,
                //showToggle: true,
                buttonsAlign: "left",
                pageList: ['10', '50'],
                searchOnEnterKey: false,
                sidePagination: 'client', //server
                pagination: true,
                singleSelect: true,
                columns: [
                    {
                        field: 'ContractNo',
                        title: '合同号',
                    }, {
                        field: 'ContractName',
                        title: '合同名称'
                    }, {
                        field: 'Name',
                        title: '姓名',
                    }, {
                        field: 'IDCard',
                        title: '证件号',
                    }, {
                        field: 'BasicNumber',
                        title: '当前基数'
                    }, {
                        field: 'ABasicNumber',
                        title: '修改后基数'
                    }],
                classes: 'table-hover table-striped',
                onClickRow: function (row, $element) {
                    //curRow = row;
                },
                onLoadSuccess: function (aa, bb, cc) {
                }
            })
            //新增基数调整类型修改
            $("#NumberItemType").change(function () {
                oTableStaff.bootstrapTable('removeAll');
                var val = $(this).val();
                if (val == '') {
                    return;
                }
                $.ajax({
                    type: "POST",
                    url: "/Staff/InfoUpdate/GetStaffBasicNumber/",
                    data: { UpdateType: val },
                    cache: false,
                    error: function (request) {
                        alert("服务器错误");
                    },
                    success: function (jsonData) {
                        try {
                            var result = $.parseJSON(jsonData);
                            if (result.StatusCode == '200') {
                                hashData = JSON.parse(result.Data);
                                hashObj = {};
                                for (var i = 0; i < hashData.length; i++) {
                                    hashObj[hashData[i].ID] = hashData[i];
                                }
                                //oTableStaff.bootstrapTable(hashData);
                                oTableStaff.bootstrapTable('load', hashData);
                            }
                        } catch (e) {
                            msghelper.alertDialog("提示", e.message);
                        }
                    }
                });
            })

            //基数更改申请保存
            $("#btnNumberSave").click(function () {
                $("#Loading").show();
                var _this = $(this);
                _this.attr("disabled", "disabled");
                if (!$("#addNumberForm").valid()) {
                    return;
                }
                var aoData = oTableStaff.bootstrapTable('getData');
                if (aoData.length == 0) {
                    return;
                }
                var data;
                var list = [];
                var obj;
                var type = $("#NumberItemType").val();
                if (type == 1) {
                    $.each(aoData, function (k, v) {
                        if (v.ABasicNumber !== '') {
                            obj = { ContractNo: v.ContractNo, StaffContractID: v.ID, BSalaryBasicNumber: v.BasicNumber, ASalaryBasicNumber: v.ABasicNumber, EffectiveDate: $("#NEffectiveDate").val(), Description: $("#Description").val() }
                            list.push(obj);
                        }
                    })
                    data = { UpdateType: type, SalaryBasicNumberList: JSON.stringify(list) };
                }
                if (type == 2) {
                    $.each(aoData, function (k, v) {
                        if (v.ABasicNumber !== '') {
                            obj = { StaffContractID: v.ID, BSIBasicNumber: v.BasicNumber, ASIBasicNumber: v.ABasicNumber, EffectiveDate: $("#NEffectiveDate").val(), Description: $("#Description").val() }
                            list.push(obj);
                        }
                    })
                    data = { UpdateType: type, SIBasicNumberList: JSON.stringify(list) };
                }
                if (type == 3) {
                    $.each(aoData, function (k, v) {
                        if (v.ABasicNumber !== '') {
                            obj = { StaffContractID: v.ID, BHFundBasicNumber: v.BasicNumber, AHFundBasicNumber: v.ABasicNumber, EffectiveDate: $("#NEffectiveDate").val(), Description: $("#Description").val() }
                            list.push(obj);
                        }
                    })
                    data = { UpdateType: type, HFundBasicNumberList: JSON.stringify(list) };
                }
                if (type == 4) {
                    $.each(aoData, function (k, v) {
                        if (v.ABasicNumber !== '') {
                            obj = { StaffContractID: v.ID, BHFundBasicNumber: v.BasicNumber, AHFundBasicNumber: v.ABasicNumber, EffectiveDate: $("#NEffectiveDate").val(), Description: $("#Description").val() }
                            list.push(obj);
                        }
                    })
                    data = { UpdateType: type, PSHFundBasicNumberList: JSON.stringify(list) };
                }
                $.ajax({
                    type: "POST",
                    url: "/Staff/InfoUpdate/BatchBasicNumber",
                    data: data,
                    cache: false,
                    error: function (request) {
                        _this.removeAttr("disabled");
                        msghelper.alertDialog("提示", "服务器错误");
                    },
                    success: function (jsonData) {
                        try {
                            var result = $.parseJSON(jsonData);
                            if (result.StatusCode == '200') {
                                oTable.bootstrapTable("refresh");
                                $("#NumberDialog").modal('hide')
                            }
                            msghelper.alertDialog("提示", result.ErrorMessage);
                        } catch (e) {
                            msghelper.alertDialog("提示", e.message);
                        }
                        _this.removeAttr("disabled");
                    },
                    complete: function () {
                        $("#Loading").hide();
                    }
                });
            })
            //导出模板
            $("#Exit").click(function () {
                if (!$("#NumberItemType").valid()) {
                    return;
                }
                var type = $("#NumberItemType").val();
                $.ajax({
                    type: "POST",
                    url: "/Staff/InfoUpdate/ExportStaffBasicNumber",
                    data: {
                        UpdateType: Number(type), FuzzyQuery: $("#addNumberForm input").val()
                    },
                    cache: false,
                    error: function (request) {
                        msghelper.alertDialog("提示", "服务器错误");
                    },
                    success: function (jsonData) {
                        try {
                            var result = $.parseJSON(jsonData);
                            if (result.StatusCode == '200') {
                                var url = baseUrl + "//" + result.Data;
                                window.location.href = url;
                            }
                        } catch (e) {
                            msghelper.alertDialog("提示", e.message);
                        }
                    }
                });
            })
            //导入模板
            $("#importf").change(function () {
                $("#Loading").show();
                importf(this)
            })
            //导入
            //导入
            var wb;//读取完成的数据
            var rABS = false; //是否将文件读取为二进制字符串
            var reader = new FileReader();
            function importf(obj) {
                if (!obj.files) {
                    return;
                }
                var f = obj.files[0];
                reader.onload = function (e) {
                    if (reader.result) reader.content = reader.result;
                    var data = reader.content;
                    if (rABS) {
                        wb = XLSX.read(btoa(data), {//手动转化
                            type: 'base64'
                        });
                    } else {
                        wb = XLSX.read(data, {
                            type: 'binary'
                        });
                    }
                    //wb.SheetNames[0]是获取Sheets中第一个Sheet的名字
                    //wb.Sheets[Sheet名]获取第一个Sheet的数据
                    //入到excel的数据
                    var aodata = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]);
                    //把excel数据放入到网页上
                    ExcelToaoData(aodata)
                    // document.getElementById("demo").innerHTML= JSON.stringify();
                };
                reader.onerror = function (ex) {
                    console.log(ex);
                };
                if (rABS) {
                    reader.readAsArrayBuffer(f);
                } else {
                    reader.readAsBinaryString(f);
                }
            }

            function ExcelToaoData(aodata) {
                //网页上表格内的数据
                var count = 0;
                var scount = 0;
                var errcount = 0;
                var errormsg = '';
                for (var i = 0; i < aodata.length; i++) {
                    count++;
                    try {
                        var ABasicNumber = aodata[i].修改后基数 != '' && aodata[i].修改后基数 != undefined ? aodata[i].修改后基数 : '';
                        if (ABasicNumber !== '') {
                            //if (618 == count) {
                            //    debugger;
                            //}
                            //scount++;
                            try {
                                ABasicNumber = Number(ABasicNumber).toFixed(2);
                            } catch (e) {
                                console.log(e);
                            }
                        }
                        if (hashObj[aodata[i].ID]) {
                            scount++;
                            hashObj[aodata[i].ID].ABasicNumber = ABasicNumber;
                        } else {
                            errcount++;
                            errormsg += aodata[i].姓名 + '、'
                        }
                    } catch (e) {
                        msghelper.alertDialog("提示", '第' + count + '(' + errormsg + ')条数据有误')
                        $("#Loading").hide();
                    }
                }
                //oTableStaff.bootstrapTable("load", []);
                oTableStaff.bootstrapTable("load", hashData);
                errormsg = errormsg.substr(0, errormsg.length - 1);
                if (errormsg.length > 0) {
                    errormsg += ' 合计 <b style="color:red">' + errcount + '</b> 数据修改失败'
                }
                msghelper.alertDialog("提示", "共导入 <b style=\"color:red\">" + aodata.length + "</b> 条数据，成功 <b style=\"color:red\">" + count + "</b> 条,其中有 <b style=\"color:red\">" + scount + "</b> 条数据被修改。" + errormsg);
                $("#Loading").hide();
            }
            //操作时判断数据是否被更改
            $(document).on("blur", ".ToggleType input", function () {
                var id = $(this).attr("id");
                if (id == 'EffectiveDate') {
                    return;
                }
                var oldValue = $.trim($(this).attr("oldvalue"));
                var newValue = $.trim($(this).val());
                oldValue == newValue ? $(this).attr("ischange", false) : $(this).attr("ischange", true);
            })
            //操作时判断数据是否被更改
            $(document).on("blur", ".ToggleType textarea", function () {
                var oldValue = $.trim($(this).attr("oldvalue"));
                var newValue = $.trim($(this).val());
                oldValue == newValue ? $(this).attr("ischange", false) : $(this).attr("ischange", true);
            })
            $(document).on("change", ".ToggleType select", function () {
                var id = $(this).attr("id");
                var oldValue = $.trim($(this).attr("oldvalue"));
                var newValue = $.trim($(this).val());
                oldValue == newValue ? $(this).attr("ischange", false) : $(this).attr("ischange", true);
                if (id == 'cmbSalaryPayMentStatus' || id == 'cmbSIPayMentStatus' || id == 'cmbHFundPayMentStatus' || id == 'cmbPSHFundPayMentStatus') {
                    if (newValue == "true") {
                        $(this).parents(".ToggleType").find("input").removeAttr("disabled")
                        $(this).parents(".ToggleType").find("select").removeAttr("disabled")
                        if (id == 'cmbSalaryPayMentStatus') {
                            getBankOfSalaryCard();
                            $("#cmbSalaryPayMentType").attr("disabled", "disabled");
                            $("#isCash").change();
                        }
                        else if (id == 'cmbSIPayMentStatus') {
                            if ($("#IsForeSIStatus").attr("value") == 0) {
                                $("#txtForeSIStartDate").attr("disabled", "disabled");
                            }
                        }
                        else if (id == 'cmbHFundPayMentStatus') {
                            if ($("#IsForeFundStatus").attr("value") == 0) {
                                $("#txtForeHFundStartDate").attr("disabled", "disabled");
                            }
                        }
                        else if (id == 'cmbPSHFundPayMentStatus') {
                            if ($("#IsForeHFundStatus").attr("value") == 0) {
                                $("#txtPSForeHFundStartDate").attr("disabled", "disabled");
                            }
                        }
                    } else {
                        $(this).parents(".ToggleType").find("input").attr("disabled", "disabled")
                        $(this).parents(".ToggleType").find("select").attr("disabled", "disabled")
                        $(this).removeAttr("disabled")
                        $(this).parents(".ToggleType").find("label[class='error']").remove();
                    }
                    var parents = $(this).parents(".ToggleType");
                    if (oldValue != newValue) {
                        return;
                        $(parents).find('input').attr("ischange", true);
                        $(parents).find('select').attr("ischange", true);
                    } else {
                        $(parents).find('input').each(function () {
                            var n = $(this).val();
                            var o = $(this).attr("oldvalue") == undefined ? '' : $(this).attr("oldvalue");
                            var isFlag = n == o ? false : true;
                            $(this).attr("ischange", isFlag)
                        })
                        $(parents).find('textarea').each(function () {
                            var n = $(this).val();
                            var o = $(this).attr("oldvalue") == undefined ? '' : $(this).attr("oldvalue");
                            var isFlag = n == o ? false : true;
                            $(this).attr("ischange", isFlag)
                        })
                        $(parents).find('select').each(function () {
                            var n = $(this).val();
                            var o = $(this).attr("oldvalue");
                            var isFlag = n == o ? false : true;
                            $(this).attr("ischange", isFlag)
                        })
                    }

                } else {

                }


            })

            //工资 是否是现金时操作
            $(document).on("change", "#isCash", function () {
                if ($("#isCash").attr("value") == "true") {
                    $("#IsNotCash").hide();
                    $("#BankList .bank").attr("disabled", "disabled");
                }
                else {
                    $("#IsNotCash").show();
                    $("#BankList .bank").removeAttr("disabled");
                }
            });
            function getBankOfSalaryCard() {
                $("#BankList").html('');
                if (BankOfSalaryCardInfo) {
                    var count = BankOfSalaryCardInfo.length;
                    $(".AddBackCard").attr("data-count", count);
                    $("#bankCardNoListDiv").show()
                    var divHtml;
                    BankArr = [];
                    $.each(BankOfSalaryCardInfo, function (k, v) {
                        BankArr.push(v.Value);
                        var list = '<div class="form-group" data-id="' + v.ID + '">\
                                                                                                                                                                <label class="col-md-3 col-sm-3 control-label"  style="padding-top:0px;" data-bankid="' + v.Value + '">' + v.Name + '</label>\
                                                                                                                                                                <div class="col-md-8 col-sm-8">\
                                                                                                                                                                    <div style="width:70%;height:auto;float:left">\
                                                                                                                                                                        <input name="SalaryCardNo_' + v.ID + '"  ischange="false" id="SalaryCardNo_' + v.ID + '" oldvalue="' + v.BankCardNo + '" type="text" placeholder="请输入银行卡号" value="' + v.BankCardNo + '" class="form-control SalaryCardNo_' + v.ID + '">\
                                                                                                                                                                    </div>'
                        if (v.IsDefault) {
                            list += '  <div style="height:auto;float:left;margin-left:10px;line-height:34px;display:none;">\
                                                                                                                                                                        <a class="BankDelete">删除</a>\
                                                                                                                                                                     </div><div style="height:auto;float:left;line-height:34px;margin-left:10px;" class="DefaultBox">\
                                                                                                                                                                    <a class="IsDefault">默认</a>\
                                                                                                                                                                 </div>';
                        } else {
                            list += ' <div style="height:auto;float:left;margin-left:10px;line-height: 34px">\
                                                                                                                                                                        <a class="BankDelete">删除</a>\
                                                                                                                                                                     </div><div style="height:auto;float:left;line-height: 34px;margin-left:10px;" class="DefaultBox">\
                                                                                                                                                                    <a class="SetDefault">设为默认</a>\
                                                                                                                                                                 </div>';
                        }
                        list += '</div>\
                                                                                                                                                                <div style="width:1%;height:auto;float:left;">\
                                                                                                                                                                    <label class="TipStar">*</label>\
                                                                                                                                                                </div>\
                                                                                                                                                            </div>\
                                                                                                                                                        </div>'
                        $("#BankList").append(list);
                        $("#SalaryCardNo_" + v.ID).rules("add", { isNullOrEmpty: true, messages: { isNullOrEmpty: "卡号不可为空" } });
                        //$("#SelBank_" + v.ID).rules("add", { isNullOrEmpty: true, messages: { isNullOrEmpty: "请选择银行卡类型" } });
                    })
                } else {
                    $("#bankCardNoListDiv").hide();
                }
            }

            //DataTable 自定义搜索
            $('#status').change(function () {
                var status = $('#status').find("option:selected").val()
                if (status == 0) {//所有申请
                    $("#btnAdd,#btnEditNumber,#btnAudit").show();
                }
                else if (status == 1) {//未审核
                    $("#btnAudit").show();
                    $("#btnAdd,#btnEditNumber").hide();
                }
                else {//通过和驳回的
                    $("#btnAdd,#btnAudit,#btnEditNumber").hide();
                }

                oTable.bootstrapTable('refresh');
            });
            GetBank("#PayrollBankId")
            //选择员工时获取对应的员工税前工资和证件号
            $("#cmbStaffContractID").change(function () {
                var staffContractID = $("#cmbStaffContractID").attr("value");
                var type = $("#ItemType").val();
                var cusContractID = $("#cmbCusContractID").val();
                if (!$("#ItemType").valid() || !$("#cmbCusContractID").valid()) {
                    return;
                }
                $(".Initform").remove();
                if (staffContractID != '') {
                    $.ajax({
                        type: "POST",
                        url: "/Staff/InfoUpdate/GetStaffInfoByTypeAndStaffContractID/",
                        data: { UpdateType: type, StaffContractID: staffContractID, CustomerContractID: cusContractID },
                        cache: false,
                        error: function (request) {
                            alert("服务器错误");
                        },
                        success: function (jsonData) {
                            try {
                                var result = $.parseJSON(jsonData);
                                if (result.StatusCode == '200') {
                                    var Data = JSON.parse(result.Data);
                                    console.log(Data);
                                    $("#BankList").html("");
                                    $("#NonFloatWagesDtl").html('');
                                    $("#BankList").html("");
                                    $(".ToggleType[data-type=" + type + "] input,.ToggleType[data-type=" + type + "] select").val('')
                                    if (type == 1) {
                                        var StaffSalaryInfo = Data.StaffSalaryInfo.StaffWagesBasicInfo;
                                        var NonFloatWagesDtl = Data.StaffSalaryInfo.NonFloatWagesDtl;
                                        var provinceList = JSON.parse(Data.provinceList);
                                        cityList = JSON.parse(Data.cityList);
                                        var pro = '<option value="">--请选择--</option>';
                                        for (var i = 0; i < provinceList.length; i++) {
                                            pro += '<option value="' + provinceList[i].ID + '">' + provinceList[i].Name + '</option>';
                                        }
                                        $('#cmbSalaryProvince').html(pro);
                                        $("#cmbSalaryProvince").change();
                                        var provinceID = 0;
                                        for (var i = 0; i < cityList.length; i++) {
                                            if (cityList[i].ID == StaffSalaryInfo.SalaryCityID) {
                                                provinceID = cityList[i].ProvinceID;
                                            }
                                        }
                                        if (NonFloatWagesDtl.length > 0) {
                                            $.each(NonFloatWagesDtl, function (k, v) {
                                                var html = '<div class="form-group">\
                                                                              <label class="col-md-3 col-sm-3 control-label">' + v.Name + '</label>\
                                                                              <div class="col-md-8 col-sm-8">\
                                                                                  <div style="width:98%;height:auto;float:left">\
                                                                                      <input id="' + v.Code + '" name="' + v.Code + '" data-name="' + v.Name + '" data-id="' + v.ID + '" value="' + v.Value + '" type="text" placeholder="' + v.Name + '" class="form-control ">\
                                                                                  </div>\
                                                                              </div>\
                                                                          </div>';
                                                $("#NonFloatWagesDtl").append(html);
                                                $("#" + v.Code).rules("add", {
                                                    isNullOrEmpty: true,
                                                    messages: {
                                                        isNullOrEmpty: v.Name + "不可为空",
                                                    }
                                                });
                                                $("#" + v.Code).attr({ "oldvalue": v.Value, "ischange": "false", "value": v.Value });
                                            })
                                        }
                                        $("#IDCard").val(StaffSalaryInfo.IDCard);
                                        BankOfSalaryCardInfo = Data.BankOfSalaryCardInfo;
                                        $("#cmbSalaryPayMentStatus").attr({ "oldvalue": StaffSalaryInfo.SalaryPayMentStatus, "ischange": "false", "value": StaffSalaryInfo.SalaryPayMentStatus }).change();
                                        if (StaffSalaryInfo.SalaryPayMentStatus) {
                                            $("#txtProbationPeriod").attr({ "oldvalue": StaffSalaryInfo.ProbationPeriod, "ischange": "false", "value": StaffSalaryInfo.ProbationPeriod });
                                            $("#txtPPSalary").attr({ "oldvalue": StaffSalaryInfo.PPSalary, "ischange": "false", "value": StaffSalaryInfo.PPSalary });
                                            $("#txtFormalSalary").attr({ "oldvalue": StaffSalaryInfo.FormalSalary, "ischange": "false", "value": StaffSalaryInfo.FormalSalary });
                                            $("#txtSalaryStartDate").attr({ "oldvalue": StaffSalaryInfo.SalaryStartDate, "ischange": "false", }).datepicker('setDate', StaffSalaryInfo.SalaryStartDate);
                                            $("#txtSalaryEndDate").attr({ "oldvalue": StaffSalaryInfo.SalaryEndDate, "ischange": "false" }).datepicker('setDate', StaffSalaryInfo.SalaryEndDate);
                                            $("#isCash").attr({ "oldvalue": StaffSalaryInfo.IsCash, "ischange": "false", "value": StaffSalaryInfo.IsCash });
                                            //发薪地
                                            $("#cmbSalaryProvince").attr({ "oldvalue": provinceID, "ischange": "false", "value": provinceID }).change();
                                            $("#cmbSalaryCity").attr({ "oldvalue": StaffSalaryInfo.SalaryCityID, "ischange": "false", "value": StaffSalaryInfo.SalaryCityID });
                                            $("#PayrollBankId").attr({ "oldvalue": StaffSalaryInfo.PayrollBankId, "ischange": "false", "value": StaffSalaryInfo.PayrollBankId });
                                        }
                                    }
                                    if (type == 2) {
                                        CitySIAndHFundScale = Data.CitySIScale;
                                        SocialInsuranceEx = Data.SocialInsuranceEx;
                                        StaffSIUpdateDtl = Data.StaffSIUpdateDtl;

                                        var StaffInfo = Data.StaffSIInfo;
                                        $("#IDCard").val(StaffInfo.IDCard);
                                        $("#cmbSIPayMentStatus").attr({ "oldvalue": StaffInfo.SIPayMentStatus, "ischange": "false", "value": StaffInfo.SIPayMentStatus }).change();
                                        if (StaffInfo.SIPayMentStatus) {
                                            $("#cmbSIPayMentType").attr({ "oldvalue": StaffInfo.SIPayMentType, "ischange": "false", "value": StaffInfo.SIPayMentType });
                                            $("#SIReceived").attr({ "oldvalue": StaffInfo.SIReceived, "ischange": "false", "value": StaffInfo.SIReceived })
                                            $("#txtSIStartDate").attr({ "oldvalue": StaffInfo.SIStartDate, "ischange": "false", }).datepicker('setDate', StaffInfo.SIStartDate);
                                            $("#txtSIEndDate").attr({ "oldvalue": StaffInfo.SIEndDate, "ischange": "false" }).datepicker('setDate', StaffInfo.SIEndDate);
                                            $("#txtBasicNumber").attr({ "oldvalue": StaffInfo.SIBasicNumber, "ischange": "false", "value": StaffInfo.SIBasicNumber });
                                            $("#txtNo").attr({ "oldvalue": StaffInfo.SINo, "ischange": "false", "value": StaffInfo.SINo });
                                            $("#SIMultiBase").attr({ "oldvalue": StaffInfo.SIMultiBase, "ischange": "false", "value": StaffInfo.SIMultiBase });
                                            StaffInfo.SIMultiBase == 0 ? $("#djs").show() : $("#djs").hide();
                                            StaffInfo.SIMultiBase == 1 ? $("#StaffSIUpdateDtl").show() : $("#StaffSIUpdateDtl").hide();
                                        }
                                        $("#StaffSIUpdateDtl").html('');
                                        var html = ''
                                        if (StaffSIUpdateDtl.length > 0) {
                                            $.each(StaffSIUpdateDtl, function (k, v) {
                                                var code = 'teshu' + k;
                                                v['code'] = code;
                                                console.log(v.BValue);
                                                html += '<div class="form-group">\
                                                                <label class="col-md-3 col-sm-3 control-label">' + v.Name + '</label>\
                                                                <div class="col-md-8 col-sm-8">\
                                                                    <div style="width:98%;height:auto;float:left">\
                                                                        <input id="' + code + '" name="' + code + '" data-id="' + v.ID + '"  data-sfid="' + v.StaffSIUpdateID +'" data-name="' + v.Name + '"  value="' + v.BValue + '" type="text" placeholder="' + v.BValue + '" class="form-control ">\
                                                                    </div>\
                                                                </div>\
                                                            </div>';
                                                $("#" + code).rules("add", {
                                                    isNullOrEmpty: true,
                                                    messages: {
                                                        isNullOrEmpty: v.Name + "不可为空",
                                                    }
                                                });
                                                $("#" + code).attr({ "oldvalue": v.BValue, "ischange": "false", "value": v.AValue });
                                            })
                                            $("#StaffSIUpdateDtl").html(html);
                                        }
                                    }
                                    if (type == 3) {
                                        CitySIAndHFundScale = Data.CityHFundScale;
                                        var StaffHFundInfo = Data.StaffHFundInfo;
                                        $("#IDCard").val(StaffHFundInfo.IDCard);
                                        $("#cmbHFundPayMentStatus").attr({ "oldvalue": StaffHFundInfo.HFundPayMentStatus, "ischange": "false", "value": StaffHFundInfo.HFundPayMentStatus }).change();
                                        if (StaffHFundInfo.HFundPayMentStatus) {
                                            $("#HFReceived").attr({ "oldvalue": StaffHFundInfo.HFReceived, "ischange": "false", "value": StaffHFundInfo.HFReceived })
                                            $("#txtHFundStartDate").attr({ "oldvalue": StaffHFundInfo.HFundStartDate, "ischange": "false", }).datepicker('setDate', StaffHFundInfo.HFundStartDate);
                                            $("#txtHFundEndDate").attr({ "oldvalue": StaffHFundInfo.HFundEndDate, "ischange": "false" }).datepicker('setDate', StaffHFundInfo.HFundEndDate);
                                            $("#txtHFundBasicNumber").attr({ "oldvalue": StaffHFundInfo.HFundBasicNumber, "ischange": "false", "value": StaffHFundInfo.HFundBasicNumber });
                                            $("#txtHFundIScale").attr({ "oldvalue": StaffHFundInfo.Scale, "ischange": "false", "value": StaffHFundInfo.Scale });
                                            $("#txtHFundNo").attr({ "oldvalue": StaffHFundInfo.HFundNo, "ischange": "false", "value": StaffHFundInfo.HFundNo });
                                        }
                                    }
                                    if (type == 4) {
                                        CitySIAndHFundScale = Data.CityHFundScale;
                                        var StaffHFundInfo = Data.StaffHFundInfo;
                                        $("#IDCard").val(StaffHFundInfo.IDCard);
                                        $("#cmbPSHFundPayMentStatus").attr({ "oldvalue": StaffHFundInfo.PSHFundPayMentStatus, "ischange": "false", "value": StaffHFundInfo.PSHFundPayMentStatus }).change();
                                        if (StaffHFundInfo.PSHFundPayMentStatus) {
                                            $("#txtPSHFundStartDate").attr({ "oldvalue": StaffHFundInfo.PSHFundStartDate, "ischange": "false", }).datepicker('setDate', StaffHFundInfo.PSHFundStartDate);
                                            $("#txtPSHFundEndDate").attr({ "oldvalue": StaffHFundInfo.PSHFundEndDate, "ischange": "false" }).datepicker('setDate', StaffHFundInfo.PSHFundEndDate);
                                            $("#txtPSHFundBasicNumber").attr({ "oldvalue": StaffHFundInfo.PSHFundBasicNumber, "ischange": "false", "value": StaffHFundInfo.PSHFundBasicNumber });
                                            $("#txtPSHFundIScale").attr({ "oldvalue": StaffHFundInfo.Scale, "ischange": "false", "value": CitySIAndHFundScale.IPSHFundScale });
                                            $("#txtPSHFundNo").attr({ "oldvalue": StaffHFundInfo.PSHFundNo, "ischange": "false", "value": StaffHFundInfo.PSHFundNo });
                                        }
                                    }
                                    if (type == 5) {

                                        StaffDimission = Data.LeavingInfo[0];
                                        DimissionID = StaffDimission.ID;
                                        Attachment = Data.Attachment;
                                        //员工离职信息 赋值
                                        $("#IDCard").val(StaffDimission.IDCard);
                                        DataPKID = StaffDimission.ID;



                                        $("#cmbDimissionType").attr({ "oldvalue": StaffDimission.DimissionType, "ischange": "false", }).val(StaffDimission.DimissionType);
                                        $("#txtDimissionDate").attr({ "oldvalue": StaffDimission.DimissionDate.substr(0, 10), "ischange": "false", }).datepicker('setDate', (StaffDimission.DimissionDate).substr(0, 10));
                                        if (StaffDimission.SalaryFinalPaymentMonth == '1970-01-01 00:00:00') {
                                            $("#SalaryFinalPaymentMonth").closest(".form-group").hide();
                                        } else {
                                            $("#SalaryFinalPaymentMonth").attr({ "oldvalue": StaffDimission.SalaryFinalPaymentMonth ? GetDate(StaffDimission.SalaryFinalPaymentMonth, 4) : '0001-01', "ischange": "false", }).datepicker('setDate', GetDate(StaffDimission.SalaryFinalPaymentMonth, 4));
                                        }
                                        if (StaffDimission.SIFinalPaymentMonth == '1970-01-01 00:00:00') {
                                            $("#SIFinalPaymentMonth").closest(".form-group").hide();
                                        } else {
                                            $("#SIFinalPaymentMonth").attr({ "oldvalue": StaffDimission.SIFinalPaymentMonth ? GetDate(StaffDimission.SIFinalPaymentMonth, 4) : '0001-01', "ischange": "false", }).datepicker('setDate', GetDate(StaffDimission.SIFinalPaymentMonth, 4));
                                        }
                                        if (StaffDimission.HFundFinalPaymentMonth == '1970-01-01 00:00:00') {
                                            $("#HFundFinalPaymentMonth").closest(".form-group").hide();
                                        } else {
                                            $("#HFundFinalPaymentMonth").attr({ "oldvalue": StaffDimission.HFundFinalPaymentMonth ? GetDate(StaffDimission.HFundFinalPaymentMonth, 4) : '0001-01', "ischange": "false", }).datepicker('setDate', GetDate(StaffDimission.HFundFinalPaymentMonth, 4));
                                        }
                                        if (StaffDimission.PSHFundFinalPaymentMonth == '1970-01-01 00:00:00') {
                                            $("#PSHFundFinalPaymentMonth").closest(".form-group").hide();
                                        } else {
                                            $("#PSHFundFinalPaymentMonth").attr({ "oldvalue": StaffDimission.PSHFundFinalPaymentMonth ? GetDate(StaffDimission.PSHFundFinalPaymentMonth, 4) : '0001-01', "ischange": "false", }).datepicker('setDate', GetDate(StaffDimission.PSHFundFinalPaymentMonth, 4));
                                        }
                                        $("#txtEconomicCompensation").attr({ "oldvalue": StaffDimission.EconomicCompensation, "ischange": "false" }).val(StaffDimission.EconomicCompensation);
                                        $("#txtDimissionCause").attr({ "oldvalue": StaffDimission.DimissionCause, "ischange": "false" }).val(StaffDimission.DimissionCause);
                                        //附件
                                        contractUrlList = [];
                                        contractConfig = [];
                                        var reg = '\.gif|\.jpeg|\.png|\.jpg|\.bmp';
                                        $.each(Attachment, function (k, v) {
                                            var url = v.FilePath + v.FileName + v.FileSuffix;
                                            if (IsIE()) {
                                            } else {
                                                contractUrlList.push(window.location.protocol + '//' + window.location.host + '//' + v.FilePath + v.FileName + v.FileSuffix)
                                                $('#File').fileinput('destroy');
                                                let Suffix = v.FileSuffix.substr(1, v.FileSuffix.length);
                                                if (reg.indexOf(Suffix.toLowerCase()) > 0) {
                                                    Suffix = 'image';
                                                }
                                                contractConfig.push({ type: Suffix.toLowerCase(), "caption": v.Name, "size": v.FileSize, "url": "/Staff/Incumbency/DelAttachment/" + v.ID, "key": v.ID });
                                            }
                                        })
                                        $("#fileList").fileinput('refresh', {
                                            initialPreview: contractUrlList,
                                            initialPreviewConfig: contractConfig,
                                        })
                                        //$("#fileList").attr({ "oldvalue": contractUrlList, "ischange": "false" });
                                        //SetFile(contractUrlList, contractConfig)
                                    }
                                }
                            } catch (e) {
                                msghelper.alertDialog("提示", e.message);
                            }
                        }
                    });
                }
            })

            //多基数切换
            $("#SIMultiBase").change(function () {
                var type = $(this).val();
                if (type == 0) {
                    $("#djs").show();
                    $("#StaffSIUpdateDtl").hide();
                } else {
                    $("#djs").hide();
                    $("#StaffSIUpdateDtl").show();
                }
            })

            //离职
            $("#fileList").fileinput({
                showCancel: false,
                showBrowse: true,
                //showDelete: false,
                previewSettings: {
                    image: { width: "100px", height: "160px" },
                },
                uploadUrl: "/Upload/UploadFile",
                showUpload: true,
                showRemove: true,
                maxFileCount: 10,
                language: 'zh',
                theme: "fa",
                width: 120,
                showCaption: false,
                overwriteInitial: false,
                initialPreviewAsData: true, // identify if you are sending preview data only and not the raw markup
                allowedFileTypes: ['image', 'pdf'],
                initialPreviewFileType: 'image',
                //initialPreview: contractUrlList,
                //initialPreviewConfig: contractConfig,
                purifyHtml: true, // this by default purifies HTML data for preview
                showPreview: true,
                showZoom: true
            }).on('filebatchselected', function (event, data, id, index) {
                var _this = this;
                setTimeout(function () {
                    if (data.length == 0) {
                        return;
                    }
                    $(_this).fileinput("upload");
                }, 100)
            }).on('fileuploaded', function (event, data) {
                try {
                    var result = $.parseJSON(data.response);
                    if (result.StatusCode == '200') {
                        NewAttachment.push($.parseJSON(result.Data));
                        NewAttachment1 = $.parseJSON(result.Data);
                        NewAttachment1.DataPKID = DataPKID;
                    } else {
                        msghelper.alertDialog("提示", result.ErrorMessage)
                    }
                } catch (e) {

                }
            });


            $('select[id$="Province"]').change(function () {
                var provinceID = $(this).find("option:checked").attr("value");
                var opt = '<option value="">--请选择--</option>';
                for (var i = 0; i < cityList.length; i++) {
                    if (cityList[i].ProvinceID == provinceID) {
                        opt += '<option value="' + cityList[i].ID + '">' + cityList[i].Name + '</option>';
                    }
                }
                $("#cmbSalaryCity").html(opt);
            });
            oTable = $('#editable-sample')
            oTable.bootstrapTable({
                url: '/Staff/InfoUpdate/QueryData',
                method: 'post',
                uniqueId: 'Id',
                toolbar: "#toolbar",
                search: true,
                cache: false,
                striped: true,
                //showRefresh: true,
                //showToggle: true,
                buttonsAlign: "left",
                pageList: ['10', '50'],
                searchOnEnterKey: false,
                queryParams: function queryParams(params) {
                    params.pageSize = params.limit;
                    params.pageIndex = params.offset / params.limit + 1;
                    params.sort = 'CreateTime';
                    params.status = $("#status").val();
                    return params;
                },
                pageNumber: 1,
                pageSize: 10,
                sidePagination: 'server',
                pagination: true,
                singleSelect: true,
                sortname: "CreateTime",
                sortOrder: 'desc',
                columns: [{
                    field: 'RowNumber',
                    title: '序号',
                },
                {
                    field: 'ContractNo',
                    title: '合同号',
                }, {
                    field: 'ContractName',
                    title: '合同名称',
                    width: 320
                }, {
                    field: 'Name',
                    title: '姓名',
                    formatter: function (value, row, index) {
                        return '<a style="color: #0180e1;" href="/Staff/InfoUpdate/Detail?id=' + row.ID + '&type=' + row.UpdateType + '">' + value + '</a>'
                    },
                }, {
                    field: 'IDCard',
                    title: '证件号',
                }, {
                    field: 'UpdateTypeName',
                    title: '更新类型'
                }, {
                    field: 'EffectiveDate',
                    title: '生效日期'
                }, {
                    field: 'CreateTime',
                    title: '创建时间',
                    sortable: true,
                }, {
                    field: 'Status',
                    title: '状态',
                    formatter: function (value, row, index) {
                        var result = "";
                        if (value == 1) {
                            result = "未审核";
                        }
                        else if (value == 2) {
                            result = "驳回";
                        }
                        else {
                            result = "通过";
                        }
                        return result;
                    }
                }],
                classes: 'table-hover table-striped',
                onClickRow: function (row, $element) {
                    //curRow = row;
                },
                onLoadSuccess: function (aa, bb, cc) {
                }
            })


        });
        function formValidate() {
            $("#Form").validate({
                ignore: ".ignore",
                rules: {
                    AuditReason: {
                        isNullOrEmpty: true,
                    }
                },
                messages: {
                    AuditReason: {
                        isNullOrEmpty: "审核理由不可为空",
                    }
                }
            })
            $("#addNumberForm").validate({
                rules: {
                    NumberItemType: {
                        isNullOrEmpty: true,
                    },
                    NEffectiveDate: {
                        isNullOrEmpty: true,
                    },
                },
                messages: {
                    NumberItemType: {
                        isNullOrEmpty: '请选择更新类型',
                    },
                    NEffectiveDate: {
                        isNullOrEmpty: "请选择生效日期",
                    },
                }
            });
            $("#addForm").validate({
                ignore: ".ignore",
                rules: {
                    ItemType: {
                        isNullOrEmpty: true,
                    },
                    cmbCusContractID: {
                        isNullOrEmpty: true,
                    },
                    NumberItemType: {
                        isNullOrEmpty: true,
                    },
                    txtProbationPeriod: {
                        isNullOrEmpty: true,
                        isInteger: true,
                    },
                    txtPPSalary: {
                        isNullOrEmpty: true,
                        isInteger: true,
                    },
                    txtFormalSalary: {
                        isNullOrEmpty: true,
                        isInteger: true,
                    },
                    cmbSalaryPayMentStatus: {
                        isNullOrEmpty: true,
                    },
                    txtSalaryStartDate: {
                        isNullOrEmpty: true,
                        isDp4: true
                    },
                    txtSalaryEndDate: {
                        isNullOrEmpty: true,
                        isDp5: true
                    },
                    cmbSIPayMentStatus: {
                        isNullOrEmpty: true,
                    },
                    cmbSIPayMentType: {
                        isNullOrEmpty: true,
                    },
                    txtSIStartDate: {
                        isNullOrEmpty: true,
                        isDp4: true
                    },
                    txtSIEndDate: {
                        isNullOrEmpty: true,
                        isDp5: true
                    },
                    txtBasicNumber: {
                        isNullOrEmpty: true,
                        isFloatGtZero: true
                    },
                    cmbHFundPayMentStatus: {
                        isNullOrEmpty: true,
                    },
                    txtHFundStartDate: {
                        isNullOrEmpty: true,
                        isDp4: true
                    },
                    txtHFundEndDate: {
                        isNullOrEmpty: true,
                        isDp5: true
                    },
                    txtHFundBasicNumber: {
                        isNullOrEmpty: true,
                        isFloatGtZero: true
                    },
                    cmbPSHFundPayMentStatus: {
                        isNullOrEmpty: true,
                    },
                    txtPSHFundStartDate: {
                        isNullOrEmpty: true,
                        isDp4: true
                    },
                    txtPSHFundEndDate: {
                        isNullOrEmpty: true,
                        isDp5: true
                    },
                    txtPSForeHFundStartDate: {
                        isNullOrEmpty: true,
                    },
                    txtPSHFundBasicNumber: {
                        isNullOrEmpty: true,
                        isFloatGtZero: true
                    },
                    cmbEarlyRetirement: {
                        isNullOrEmpty: true,
                    },
                    txtRetirementDate: {
                        isNullOrEmpty: true,
                    },
                    txtSalaryCardNo: {
                        isNullOrEmpty: true,
                    },
                    txtHFundIScale: {
                        isNullOrEmpty: true,
                        number: true,
                        isFloatGtZero: true,
                        maxlength: 6
                    }, txtPSHFundIScale: {
                        isNullOrEmpty: true,
                        number: true,
                        isFloatGtZero: true,
                        maxlength: 6,
                    },

                    EffectiveDate: {
                        isNullOrEmpty: true,
                    },
                    cmbDimissionType: {
                        isNullOrEmpty: true
                    },
                    txtDimissionDate: {
                        isNullOrEmpty: true,
                        date: true
                    },
                    SIFinalPaymentMonth: {
                        isNullOrEmpty: true,
                    },
                    HFundFinalPaymentMonth: {
                        isNullOrEmpty: true,
                    },
                    PSHFundFinalPaymentMonth: {
                        isNullOrEmpty: true,
                    },
                    SalaryFinalPaymentMonth: {
                        isNullOrEmpty: true,
                    },
                    txtEconomicCompensation: {
                        isNullOrEmpty: true,
                        maxlength: 16,
                        number: true
                    },
                    txtDimissionCause: {
                        isNullOrEmpty: true,
                        maxlength: 500
                    },
                    txtDescription: {
                        maxlength: 500
                    },
                },
                messages: {
                    EffectiveDate: {
                        isNullOrEmpty: "请选择生效日期",
                    },

                    NumberItemType: {
                        isNullOrEmpty: "请选择更新类型",
                    },
                    ItemType: {
                        isNullOrEmpty: "请选择新增类型",
                    },
                    cmbCusContractID: {
                        isNullOrEmpty: "请选择立项",
                    },
                    txtProbationPeriod: {
                        isNullOrEmpty: "请填写试用期月数",
                        isInteger: "请正确输入试用期月数",
                    },
                    txtPPSalary: {
                        isNullOrEmpty: "请填写试用期工资",
                        isInteger: "请正确输入试用期金额"
                    },
                    txtFormalSalary: {
                        isNullOrEmpty: "请填写转正后工资",
                        isInteger: "请正确输入转正后金额"
                    },
                    cmbSalaryPayMentStatus: {
                        isNullOrEmpty: "请选择是否发放工资",
                    },
                    txtSalaryStartDate: {
                        isNullOrEmpty: "请填写工资始发日期",
                    },
                    txtSalaryEndDate: {
                        isNullOrEmpty: "请填写工资止发日期",
                    },
                    cmbSIPayMentStatus: {
                        isNullOrEmpty: "请选择是否缴纳社保",
                    },
                    cmbSIPayMentType: {
                        isNullOrEmpty: "请选择社保类型",
                    },
                    txtSIStartDate: {
                        isNullOrEmpty: "请填写社保起始日期",
                    },
                    txtSIEndDate: {
                        isNullOrEmpty: "请填写社保起始日期",
                    },
                    txtBasicNumber: {
                        isNullOrEmpty: "请填写社保基数",
                        isFloatGtZero: "社保基数必须大于0",
                        number: "请填写正确的金额"
                    },
                    cmbHFundPayMentStatus: {
                        isNullOrEmpty: "请选择是否缴纳公积金",
                    },
                    txtHFundStartDate: {
                        isNullOrEmpty: "请填写公积金起始日期",
                    },
                    txtHFundEndDate: {
                        isNullOrEmpty: "请填写公积金起始日期",
                    },
                    txtHFundBasicNumber: {
                        isNullOrEmpty: "请填写公积金基数",
                        isFloatGtZero: "公积金基数必须大于0",
                        number: "请填写正确的金额"
                    },
                    cmbPSHFundPayMentStatus: {
                        isNullOrEmpty: "请选择是否缴纳补充公积金",
                    },
                    txtPSHFundStartDate: {
                        isNullOrEmpty: "请填写补充公积金起始日期",
                    },
                    txtPSHFundEndDate: {
                        isNullOrEmpty: "请填写补充公积金起始日期",
                    },
                    txtPSForeHFundStartDate: {
                        isNullOrEmpty: "请填写补充公积金补缴起始日期",
                    },
                    txtPSHFundBasicNumber: {
                        isNullOrEmpty: "请填写补充公积金基数",
                        isFloatGtZero: "补充公积金基数必须大于0",
                        number: "请填写正确的金额"
                    },
                    cmbEarlyRetirement: {
                        isNullOrEmpty: "请选择是否提前退休",
                    },
                    txtRetirementDate: {
                        isNullOrEmpty: "请填写退休日期",
                    },
                    txtSalaryCardNo: {
                        isNullOrEmpty: "请填写工资卡",
                    },
                    txtHFundIScale: {
                        isNullOrEmpty: "请输入个人公积金比例",
                        number: "请输入正确的比例",
                        maxlength: "长度不能超过6位"
                    },
                    txtPSHFundIScale: {
                        isNullOrEmpty: "请输入单位公积金比例",
                        number: "请输入正确的比例",
                        maxlength: "长度不能超过6位"
                    },
                    cmbDimissionType: {
                        isNullOrEmpty: "请选择离职方式"
                    },
                    txtDimissionDate: {
                        isNullOrEmpty: "请输入离职日期",
                        date: "请输入正确的日期格式"
                    },
                    SIFinalPaymentMonth: {
                        isNullOrEmpty: "社保止缴月不可为空",
                    },
                    HFundFinalPaymentMonth: {
                        isNullOrEmpty: "公积金止缴月不可为空",
                    },
                    PSHFundFinalPaymentMonth: {
                        isNullOrEmpty: "补充公积金止缴月不可为空",
                    },
                    SalaryFinalPaymentMonth: {
                        isNullOrEmpty: "薪止缴月不可为空",
                    },
                    txtEconomicCompensation: {
                        isNullOrEmpty: "请输入经济补偿金",
                        maxlength: "长度不能超过16位",
                        number: "请输入正确的经济补偿金"
                    },
                    txtDimissionCause: {
                        isNullOrEmpty: "请输入离职原因",
                        maxlength: "长度不能超过500位"
                    },
                    txtDescription: {
                        maxlength: "长度不能超过500位"
                    },
                    TransferringContract: {
                        SelectpickerIsNull: "立项不可为空",
                    },
                    TransferringCause: {
                        isNullOrEmpty: "流转理由不可为空",
                    }
                }
            });
        }
        //保存新增的工资调整申请和审核工资调整申请
        $(document).on("click", "#btnSave", function () {
            var _this = $(this);
            _this.attr("disabled", "disabled");
            if (!$("#addForm").valid()) {
                _this.removeAttr("disabled");
                return;
            }
            var jsonData;
            var type = $("#ItemType").val();
            var url = '/Staff/InfoUpdate/Add';
            if (type == 1) {
                $("[ischange]").each(function () {
                    if ($(this).attr("ischange") == "true")
                        flag = true;
                })
                if (!flag) {
                    msghelper.alertDialog("提示", "您未更改过任何信息");
                    return;
                }
                //工资
                var BankOfData = [];
                var isCash = $("#isCash").val();
                //被删除
                for (var i = 0; i < BankOfSalaryCardInfo.length; i++) {
                    if (DeleteArr.indexOf(BankOfSalaryCardInfo[i].ID) != -1) {
                        var obj = {
                            IsDefault: false,
                            IsDelete: true,
                            Updated: true,
                            ABankCardNo: '',
                            BBankCardNo: BankOfSalaryCardInfo[i].BankCardNo,
                            ID: BankOfSalaryCardInfo[i].ID,
                            BankOfSalaryCardID: BankOfSalaryCardInfo[i].Value,
                        }
                        BankOfData.push(obj);
                    }
                }
                //目前有的项
                $("#BankList .form-group").each(function () {
                    var id = $(this).attr("data-id");
                    if (id < 0) {
                        var BankOfSalaryCardInfo = $(this).find("select option:selected").val();
                        var ABankCardNo = $(this).find("input").val();
                        var IsDefault = $(this).find(".IsDefault")[0] == undefined ? false : true;
                        BankOfData.push({ ID: id, BankOfSalaryCardID: BankOfSalaryCardInfo, BBankCardNo: '', ABankCardNo: ABankCardNo, IsDefault: IsDefault, Updated: true, IsDelete: false });
                    } else {
                        var CardInfo = isCash == "true" ? '' : $("#SalaryCardNo_" + id).val();
                        var BankOfSalaryCardInfo = $(this).find("label").attr("data-bankid");
                        var isChange = $("#SalaryCardNo_" + id).attr("ischange") == 'false' ? false : true;
                        var oldValue = $("#SalaryCardNo_" + id).attr("oldvalue");
                        var IsDefault = $(this).find(".IsDefault")[0] == undefined ? false : true;
                        //CardInfo = isChange ? CardInfo : null;
                        BankOfData.push({ ID: id, BankOfSalaryCardID: BankOfSalaryCardInfo, BBankCardNo: oldValue, ABankCardNo: CardInfo, IsDefault: IsDefault, Updated: isChange, IsDelete: false });
                    }
                })
                jsonData = {
                    StaffContractID: $("#cmbStaffContractID").attr("value"),
                    BSalaryPayMentStatus: $("#cmbSalaryPayMentStatus").attr("oldvalue"),
                    SalaryPayMentStatusUpdated: $("#cmbSalaryPayMentStatus").attr("ischange"),
                    ASalaryPayMentStatus: $("#cmbSalaryPayMentStatus").attr("ischange") == "true" ? $("#cmbSalaryPayMentStatus").val() : 0,
                    BSalaryStartDate: $("#txtSalaryStartDate").attr("oldvalue"),
                    SalaryStartDateUpdated: $("#txtSalaryStartDate").attr("ischange"),
                    ASalaryStartDate: $("#txtSalaryStartDate").attr("ischange") == "true" ? $("#txtSalaryStartDate").val() : '0001-01-01',
                    BSalaryEndDate: $("#txtSalaryEndDate").attr("oldvalue"),
                    SalaryEndDateUpdated: $("#txtSalaryEndDate").attr("ischange"),
                    ASalaryEndDate: $("#txtSalaryEndDate").attr("ischange") == "true" ? $("#txtSalaryEndDate").val() : '0001-01-01',
                    BIsCash: $("#isCash").attr("oldvalue"),
                    IsCashUpdated: $("#isCash").attr("ischange"),
                    AIsCash: $("#isCash").attr("ischange") == "true" ? $("#isCash").val() : 0,
                    BProbationPeriod: $("#txtProbationPeriod").attr("oldvalue"),
                    ProbationPeriodUpdated: $("#txtProbationPeriod").attr("ischange"),
                    AProbationPeriod: $("#txtProbationPeriod").attr("ischange") == "true" ? $("#txtProbationPeriod").val() : 0,
                    BPPSalary: $("#txtPPSalary").attr("oldvalue"),
                    PPSalaryUpdated: $("#txtPPSalary").attr("ischange"),
                    APPSalary: $("#txtPPSalary").attr("ischange") == "true" ? $("#txtPPSalary").val() : 0,
                    BFormalSalary: $("#txtFormalSalary").attr("oldvalue"),
                    FormalSalaryUpdated: $("#txtFormalSalary").attr("ischange"),
                    AFormalSalary: $("#txtFormalSalary").attr("ischange") == "true" ? $("#txtFormalSalary").val() : 0,
                    EffectiveDate: $("#EffectiveDate").val(),
                    Description: $("#txtDescription").val(),
                    ASalaryCityID: $("#cmbSalaryCity").attr("ischange") == "true" ? $("#cmbSalaryCity").val() : 0,
                    BSalaryCityID: $("#cmbSalaryCity").attr("oldvalue"),
                    SalaryCityIDUpdated: $("#cmbSalaryCity").attr("ischange"),
                    PayrollBankIdAfter: $("#PayrollBankId").attr("ischange") == "true" ? $("#PayrollBankId").val() : 0,
                    PayrollBankIdUpdated: $("#PayrollBankId").attr("ischange"),
                    PayrollBankIdBefore: $("#PayrollBankId").attr("oldvalue"),
                    BankCardNo: JSON.stringify(BankOfData)
                };
                var NonFloatWagesUpdateDtl = [];
                $("#NonFloatWagesDtl input").each(function () {
                    var obj = {
                        NonFloatWagesID: $(this).attr("data-id"),
                        BValue: $(this).attr("oldvalue"),
                        ValueUpdated: $(this).attr("ischange"),
                        NonFloatWagesName: $(this).attr("data-name"),
                        AValue: $(this).attr("ischange") == "true" ? $(this).val() : 0,
                    };
                    NonFloatWagesUpdateDtl.push(obj);
                })
                jsonData = { StaffSalaryUpdate: JSON.stringify(jsonData), UpdateType: type, NonFloatWagesUpdateDtl: JSON.stringify(NonFloatWagesUpdateDtl) };
            }
            else if (type == 2) {
                //社保
                jsonData = {
                    StaffContractID: $("#cmbStaffContractID").attr("value"),
                    BSIPayMentStatus: $("#cmbSIPayMentStatus").attr("oldvalue"),
                    SIPayMentStatusUpdated: $("#cmbSIPayMentStatus").attr("ischange"),
                    ASIPayMentStatus: $("#cmbSIPayMentStatus").attr("ischange") == "true" ? $("#cmbSIPayMentStatus").val() : 0,
                    BSIPayMentType: $("#cmbSIPayMentType").attr("oldvalue"),
                    SIPayMentTypeUpdated: $("#cmbSIPayMentType").attr("ischange"),
                    ASIPayMentType: $("#cmbSIPayMentType").attr("ischange") == "true" ? $("#cmbSIPayMentType").val() : 0,
                    BSIReceived: $("#SIReceived").attr("oldvalue"),
                    SIReceivedUpdated: $("#SIReceived").attr("ischange"),
                    ASIReceived: Number($("#SIReceived").val()),
                    BSIStartDate: $("#txtSIStartDate").attr("oldvalue"),
                    SIStartDateUpdated: $("#txtSIStartDate").attr("ischange"),
                    ASIStartDate: $("#txtSIStartDate").attr("ischange") == "true" ? $("#txtSIStartDate").val() : '0001-01-01',
                    BSIEndDate: $("#txtSIEndDate").attr("oldvalue"),
                    SIEndDateUpdated: $("#txtSIEndDate").attr("ischange"),
                    ASIEndDate: $("#txtSIEndDate").attr("ischange") == "true" ? $("#txtSIEndDate").val() : '0001-01-01',
                    BSIBasicNumber: $("#txtBasicNumber").attr("oldvalue"),
                    SIBasicNumberUpdated: $("#txtBasicNumber").attr("ischange"),
                    ASIBasicNumber: $("#txtBasicNumber").attr("ischange") == "true" ? $("#txtBasicNumber").val() : 0,
                    BSINo: $("#txtNo").attr("oldvalue"),
                    SINoUpdated: $("#txtNo").attr("ischange"),
                    ASINo: $("#txtNo").attr("ischange") == "true" ? $("#txtNo").val() : 0,
                    EffectiveDate: $("#EffectiveDate").val(),
                    Description: $("#txtDescription").val(),
                    BSIMultiBase: $("#SIMultiBase").attr("oldvalue"),
                    SIMultiBaseUpdated: $("#SIMultiBase").attr("ischange"),
                    ASIMultiBase: $("#SIMultiBase").attr("ischange") == "true" ? $("#SIMultiBase").val() : 0,

                };


                var StaffSIUpdateDtlArr = [];
                $("#StaffSIUpdateDtl input").each(function () {
                    var obj = {
                        BValue: $(this).attr("oldvalue"),
                        ValueUpdated: $(this).attr("ischange"),
                        Name: $(this).attr("data-name"),
                        AValue: $(this).attr("ischange") == "true" ? $(this).val() : 0,
                        StaffSIUpdateID: $(this).attr("data-sfid"),
                        ID: $(this).attr("data-id"),
                    };
                    StaffSIUpdateDtlArr.push(obj);
                })
                jsonData = { StaffSIUpdate: JSON.stringify(jsonData), UpdateType: type, StaffSIUpdateDtl: JSON.stringify(StaffSIUpdateDtlArr) };
                console.log(jsonData);
            }
            else if (type == 3 || type == 4) {
                //公积金
                var txt = type == 3 ? '' : 'PS';
                jsonData = {
                    StaffContractID: $("#cmbStaffContractID").attr("value"),
                    //公积金补充公积金 一起预收/不预收
                    BHFReceived: $("#HFReceived").attr("oldvalue"),
                    HFReceivedUpdated: $("#HFReceived").attr("ischange"),
                    AHFReceived: Number($("#HFReceived").val()),
                    HFundType: type == 3 ? 1 : 2,//1：公积金 2：补充公积金
                    BHFundPayMentStatus: $("#cmb" + txt + "HFundPayMentStatus").attr("oldvalue"),
                    HFundPayMentStatusUpdated: $("#cmb" + txt + "HFundPayMentStatus").attr("ischange"),
                    AHFundPayMentStatus: $("#cmb" + txt + "HFundPayMentStatus").attr("ischange") == "true" ? $("#cmb" + txt + "HFundPayMentStatus").val() : 0,
                    BHFundStartDate: $("#txt" + txt + "HFundStartDate").attr("oldvalue"),
                    HFundStartDateUpdated: $("#txt" + txt + "HFundStartDate").attr("ischange"),
                    AHFundStartDate: $("#txt" + txt + "HFundStartDate").attr("ischange") == "true" ? $("#txt" + txt + "HFundStartDate").val() : '0001-01-01',
                    BHFundEndDate: $("#txt" + txt + "HFundEndDate").attr("oldvalue"),
                    HFundEndDateUpdated: $("#txt" + txt + "HFundEndDate").attr("ischange"),
                    AHFundEndDate: $("#txt" + txt + "HFundEndDate").attr("ischange") == "true" ? $("#txt" + txt + "HFundEndDate").val() : '0001-01-01',
                    BHFundBasicNumber: $("#txt" + txt + "HFundBasicNumber").attr("oldvalue"),
                    HFundBasicNumberUpdated: $("#txt" + txt + "HFundBasicNumber").attr("ischange"),
                    AHFundBasicNumber: $("#txt" + txt + "HFundBasicNumber").attr("ischange") == "true" ? $("#txt" + txt + "HFundBasicNumber").val() : 0,
                    BHFundIScale: $("#txt" + txt + "HFundIScale").attr("oldvalue"),
                    HFundIScaleUpdated: $("#txt" + txt + "HFundIScale").attr("ischange"),
                    AHFundIScale: $("#txt" + txt + "HFundIScale").attr("ischange") == "true" ? $("#txt" + txt + "HFundIScale").val() : 0,
                    BHFundNo: $("#txt" + txt + "HFundNo").attr("oldvalue"),
                    HFundNoUpdated: $("#txt" + txt + "HFundNo").attr("ischange"),
                    AHFundNo: $("#txt" + txt + "HFundNo").attr("ischange") == "true" ? $("#txt" + txt + "HFundNo").val() : 0,
                    EffectiveDate: $("#EffectiveDate").val(),
                    Description: $("#txtDescription").val()
                };
                jsonData = { StaffHFundUpdate: JSON.stringify(jsonData), UpdateType: type };
            } else if (type == 5) {
                jsonData = {
                    DimissionID: DimissionID,
                    BeDimissionType: $("#cmbDimissionType").attr("oldvalue"),
                    DimissionTypeUpdated: $("#cmbDimissionType").attr("ischange"),
                    AfDimissionType: $("#cmbDimissionType").attr("ischange") == "true" ? $("#cmbDimissionType").val() : 0,
                    BeDimissionDate: $("#txtDimissionDate").attr("oldvalue"),
                    DimissionDateUpdated: $("#txtDimissionDate").attr("ischange"),
                    AfDimissionDate: $("#txtDimissionDate").val(),
                    BeSalaryFinalPaymentMonth: $("#SalaryFinalPaymentMonth").attr("ischange") == undefined ? '1970-01-01' : $("#SalaryFinalPaymentMonth").attr("oldvalue"),
                    SalaryFinalPaymentMonthUpdated: $("#SalaryFinalPaymentMonth").attr("ischange") == undefined ? false : $("#SalaryFinalPaymentMonth").attr("ischange"),
                    AfSalaryFinalPaymentMonth: $("#SalaryFinalPaymentMonth").attr("ischange") == undefined ? '1970-01-01' : $("#SalaryFinalPaymentMonth").attr("ischange") == "true" ? $("#SalaryFinalPaymentMonth").val() : '1970-01-01',
                    BeSIFinalPaymentMonth: $("#SIFinalPaymentMonth").attr("ischange") == undefined ? '1970-01-01' : $("#SIFinalPaymentMonth").attr("oldvalue"),
                    SIFinalPaymentMonthUpdated: $("#SIFinalPaymentMonth").attr("ischange") == undefined ? false : $("#SIFinalPaymentMonth").attr("ischange"),
                    AfSIFinalPaymentMonth: $("#SIFinalPaymentMonth").attr("ischange") == undefined ? '1970-01-01' : $("#SIFinalPaymentMonth").attr("ischange") == "true" ? $("#SIFinalPaymentMonth").val() : '1970-01-01',
                    BeHFundFinalPaymentMonth: $("#HFundFinalPaymentMonth").attr("ischange") == undefined ? '1970-01-01' : $("#HFundFinalPaymentMonth").attr("oldvalue"),
                    HFundFinalPaymentMonthUpdated: $("#HFundFinalPaymentMonth").attr("ischange") == undefined ? false : $("#HFundFinalPaymentMonth").attr("ischange"),
                    AfHFundFinalPaymentMonth: $("#HFundFinalPaymentMonth").attr("ischange") == undefined ? '1970-01-01' : $("#HFundFinalPaymentMonth").attr("ischange") == "true" ? $("#HFundFinalPaymentMonth").val() : '1970-01-01',
                    BePSHFundFinalPaymentMonth: $("#PSHFundFinalPaymentMonth").attr("ischange") == undefined ? '1970-01-01' : $("#PSHFundFinalPaymentMonth").attr("oldvalue"),
                    PSHFundFinalPaymentMonthUpdated: $("#PSHFundFinalPaymentMonth").attr("ischange") == undefined ? false : $("#PSHFundFinalPaymentMonth").attr("ischange"),
                    AfPSHFundFinalPaymentMonth: $("#PSHFundFinalPaymentMonth").attr("ischange") == undefined ? '1970-01-01' : $("#PSHFundFinalPaymentMonth").attr("ischange") == "true" ? $("#PSHFundFinalPaymentMonth").val() : '1970-01-01',
                    BeEconomicCompensation: $("#txtEconomicCompensation").attr("oldvalue"),
                    EconomicCompensationUpdated: $("#txtEconomicCompensation").attr("ischange"),
                    AfEconomicCompensation: $("#txtEconomicCompensation").attr("ischange") == "true" ? $("#txtEconomicCompensation").val() : 0,
                    BeDimissionCause: $("#txtDimissionCause").attr("oldvalue"),
                    DimissionCauseUpdated: $("#txtDimissionCause").attr("ischange"),
                    AfDimissionCause: $("#txtDimissionCause").attr("ischange") == "true" ? $("#txtDimissionCause").val() : '',
                    EffectiveDate: $("#EffectiveDate").val(),
                    Description: $("#txtDescription").val()
                };
                jsonData = { StaffAttachment: JSON.stringify(jsonData), UpdateType: type, uploadedAttachment: JSON.stringify(NewAttachment1) };
            }
            $.ajax({
                type: "POST",
                data: jsonData,
                url: url,
                cache: false,
                error: function (request) {
                    _this.removeAttr("disabled");
                    alert("服务器错误");
                },
                success: function (jsonData) {
                    try {
                        var result = $.parseJSON(jsonData);
                        if (result.StatusCode == '200') {
                            _this.removeAttr("disabled");
                            $("#AddDialog").modal("hide");
                            oTable.bootstrapTable('refresh')
                        } else {
                            msghelper.alertDialog("提示", result.ErrorMessage);
                        }
                    } catch (e) {
                        msghelper.alertDialog("提示", e.message);
                    }
                }
            });
        })

        //选择了申请类型和客户立项信息后获取对应的员工信息
        function getStaffInfo(type, cusContractID) {
            $("#cmbStaffContractID,#IDCard").attr("value");
            $.ajax({
                type: "GET",
                url: "/Staff/InfoUpdate/GetStaffInfoByType",
                data: { Type: type, CustomerContractID: cusContractID },
                cache: false,
                error: function (request) {
                    alert("服务器错误");
                },
                success: function (jsonData) {
                    try {
                        var result = $.parseJSON(jsonData);
                        if (result.StatusCode == '200') {
                            result = JSON.parse(result.Data);
                            var html = '<option value="">--请选择--</option>';
                            for (var i = 0; i < result.length; i++) {
                                html += '<option value="' + result[i].ID + '">' + result[i].Name + '</option>';
                            }
                            $("#cmbStaffContractID").selectpicker('destroy').html(html).selectpicker({
                                selectAllText: '全选',
                                deselectAllText: "清除",
                                showContent: true,
                                noneSelectedText: "请选择",
                                liveSearchPlaceholder: "请输入关键字",
                            }).selectpicker('refresh').selectpicker('render');


                        }
                    } catch (e) {
                        msghelper.alertDialog("提示", e.message);
                    }
                }
            });
        }
    </script>
}
